package com.example.mapper;

import com.example.pojo.ArticleCategory;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ArticleCategoryMapper {
//查询所有部门数据
    @Select("select id, name, create_time, update_time from blog_system.article_categories order by update_time desc")
    List<ArticleCategory> findAll();
//根据ID删除
    @Delete("delete from blog_system.article_categories where id=#{id}")
    void deleteById(Integer id);
//新增部门
    @Insert("insert into blog_system.article_categories(name,create_time,update_time) values(#{name},#{createTime},#{updateTime})")
    void add(ArticleCategory dept);
    //根据ID查
    @Select("select id,name,create_time,update_time from blog_system.article_categories where id=#{id}")
    ArticleCategory getById(Integer id);
@Update("update blog_system.article_categories set name=#{name},update_time=#{updateTime} where id=#{id}")
    void updata(ArticleCategory dept);
}
